{{include file="public/header" /}}
<style>
    *{ margin:0; padding:0; list-style:none; text-decoration:none;}
    .wraper{ width:100%; padding-bottom:20px;margin-top: 30px; }
    .nav{ position:relative; width:100%; height:40px; background:#eee; overflow:hidden}
    .nav-item{ position:relative; float:left; width:160px; height:40px; line-height:40px; text-align:center; font-size:14px; z-index:1}
    .nav-item a{ display:block; height:40px; color:#111;}
    .nav-item a:hover{ color:#fff}
    .move-bg{ display:none;position:absolute;left:0;top:0; width:160px; height:40px; background:#4386fb; z-index:0}
    .bg a{background:#4386fb;color:#fff;}
</style>

<!-- right content start  -->
<div class="content-right">
    <div class="content">
        <div class="am-g m-t-15">
            <form class="am-form form-validation form-search" method="post" action="{{:MyUrl('admin/Arrivalreminder/index')}}" request-type="form">
                <div class="thin">
                    <div class="am-input-group am-input-group-sm am-fl so">
                        <input type="text" autocomplete="off" name="keywords" class="am-radius" placeholder="标题" value="{{if !empty($params.keywords)}}{{$params.keywords}}{{/if}}" />
                        <span class="am-input-group-btn">
                            <button class="am-btn am-btn-default am-radius" type="submit" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜索</button>
                        </span>
                    </div>
                    <label class="am-fl thin_sub more-submit">
                        更多筛选条件
                        {{if isset($params['is_more']) and $params['is_more'] eq 1}}
                        <input type="checkbox" name="is_more" value="1" id="is_more" checked />
                        <i class="am-icon-angle-up"></i>
                        {{else /}}
                        <input type="checkbox" name="is_more" value="1" id="is_more" />
                        <i class="am-icon-angle-down"></i>
                        {{/if}}
                    </label>
                </div>
                <table class="so-list more-where {{if !isset($params['is_more'])}}none{{/if}}">
                    <tbody>
                        <tr>

                            <td>
                                <span>用户：</span>
                                <input type="text"  style="width:217px"    name="username" value="{{if !empty($params.username)}}{{$params.username}}{{/if}}"  />
                            </td>

                            <td class="time">
                                <span>时间：</span>
                                <span>
                                    <input type="text" autocomplete="off" name="time_start" class="am-form-field am-input-sm am-radius Wdate" placeholder="起始时间" value="{{if !empty($params.time_start)}}{{$params.time_start}}{{/if}}" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek: 1, dateFmt: 'yyyy-MM-dd'})" autocomplete="off" /><i class="am-icon-calendar"></i>
                                </span>
                                <em class="text-grey">~</em>
                                <span>
                                    <input type="text" autocomplete="off" name="time_end" class="am-form-field am-input-sm am-radius Wdate" placeholder="结束时间" value="{{if !empty($params.time_end)}}{{$params.time_end}}{{/if}}" pattern="^[0-9]{4}-[0-9]{2}-[0-9]{2}$" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek: 1, dateFmt: 'yyyy-MM-dd'})" autocomplete="off" /><i class="am-icon-calendar"></i>
                                </span>
                            </td>

                        </tr>


                        <tr>
                            <td>
                                <button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜索</button>
                                <a href="{{:MyUrl('admin/goods/index')}}" class="am-btn am-btn-warning am-radius am-btn-sm reset-submit">清除条件</a>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </form>
            <div class="wraper">    
                <div class="nav">
                    <ul>
                        <li class="nav-item {{if (isset($params['type_num'])  and  $params['type_num'] eq 0) or empty($params['type_num']) }}bg{{/if}}" ><a href='{{:MyUrl('admin/Arrivalreminder/index',['type_num'=>0])}}'>全部商品</a></li>
                        <li class="nav-item {{if !empty($params['type_num'])  and  $params['type_num'] eq 1}}bg{{/if}}"><a href='{{:MyUrl('admin/Arrivalreminder/index',['type_num'=>1])}}'>未提醒</a></li>
                        <li class="nav-item {{if !empty($params['type_num'])  and  $params['type_num'] eq 2}}bg{{/if}}"><a href='{{:MyUrl('admin/Arrivalreminder/index',['type_num'=>2])}}'>已提醒</a></li>
                        <li class="nav-item {{if !empty($params['type_num'])  and  $params['type_num'] eq 3}}bg{{/if}}"><a href='{{:MyUrl('admin/Arrivalreminder/index',['type_num'=>3])}}'>未到货</a></li>
                        <li class="nav-item {{if !empty($params['type_num'])  and  $params['type_num'] eq 4}}bg{{/if}}"><a href='{{:MyUrl('admin/Arrivalreminder/index',['type_num'=>4])}}'>已取消</a></li> 
                    </ul>
                    <!--移动的滑动-->
                    <div class="move-bg"></div>
                    <!--移动的滑动 end-->
                </div>
            </div>
        </div>
         <!-- operation start -->
        <div class="am-g m-t-15">
            <a href="javascript:void();" id="remind" class="am-btn am-btn-secondary am-radius am-btn-xs am-icon-plus"> 批量提醒</a>
        </div>
        <!-- operation end -->

        <!-- list start -->
        <table class="am-table am-table-striped am-table-hover am-text-middle m-t-10 goods-list">
            <thead>
                <tr>

                    <th><input type="checkbox" id="CheckAll">&nbsp;全选</th>
                    <th>编号</th>
                    <th>商品名称</th>
                    <th class="am-hide-sm-only">商品封面</th>
                    <th class="am-hide-sm-only">用户账号</th>
                    <th>是否提醒</th>
                    <th class="am-hide-sm-only">创建时间</th>
                    <th class="am-hide-sm-only">提醒时间</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                {{if !empty($data_list)}}
                {{foreach $data_list as $v}}
                <tr id="data-list-{{$v.id}}"  >
                    <td><input type="checkbox" class="dh" name='ids[]' value="{{$v.id}}" ></td>
                    <td>{{$v.id}}</td>
                    <td>
                        {{$v.title}} 
                    </td>     
                    <td class="am-hide-sm-only"><img width="100" height="60" src="{{$v.images}}" /> </td>

                    <td class="am-hide-sm-only">{{$v.username}}</td>
                    <td><a href="javascript:;" style="font-size: 14px;width: 18px; height: 18px;line-height: 18px" class="am-icon-btn am-icon-check   {{if $v['status'] eq 1}}am-success{{else /}}am-default{{/if}}"></a></td>

                    <td class="am-hide-sm-only">{{$v.add_time|date='Y-m-d H:i:s'}}</td>

                      <td class="am-hide-sm-only">    {{if !empty($v['upd_time'])}}{{$v.upd_time|date='Y-m-d H:i:s'}}   {{/if}}</td>
                    <td class="view-operation">

                        {{if $v['status'] eq 1}}
                        已提醒
                        {{else /}}
                        <button class="am-btn am-btn-warning am-btn-xs am-radius am-icon-remove submit-ajax" data-url="{{:MyUrl('admin/Arrivalreminder/statusShelves')}}" data-state="{{$v['status']}}"  data-id="{{$v.id}}" data-view="reload"    data-msg="确认操作吗？"> 到货提醒</button>
                        {{/if}}
                    </td>
                </tr>
                {{/foreach}}
                {{/if}}
            </tbody>
        </table>
        {{if empty($data_list)}}
        <div class="table-no"><i class="am-icon-warning"></i> 没有相关数据</div>
        {{/if}}
        <!-- list end -->

        <!-- page start -->
        {{if !empty($data_list)}}
        {{$page_html|raw}}
        {{/if}}
        <!-- page end -->
    </div>
</div>
<!-- right content end  -->

<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->
<script type='text/javascript' src="{{$Think.__MY_ROOT_PUBLIC__}}static/admin/default/js/jquery.movebg.js"></script>
<script>
                                        $(function () {
                                            $(".nav").movebg({width: 160/*滑块的大小*/, extra: 40/*额外反弹的距离*/, speed: 300/*滑块移动的速度*/, rebound_speed: 400/*滑块反弹的速度*/});
                                        })


                                        $("#CheckAll").bind("click", function () {
                                            $("input[name='ids[]']").prop("checked", this.checked);
                                        });


                                        $("#remind").click(function () {
                                            if (confirm('确定要批量提醒所选?')) {
                                                var checks = $("input[name='ids[]']:checked");
                                                if (checks.length == 0) {
                                                    alert('未选中任何项！');
                                                    return false;
                                                }
                                                //将获取的值存入数组
                                                var checkData = new Array();
                                                checks.each(function () {
                                                    checkData.push($(this).val());
                                                });
                                                    
                                                    $.post("{{:MyUrl('admin/Arrivalreminder/statusShelves')}} ",
                                                        {id: checkData.toString()},
                                                        function (result) {
                                                            
                                                            if (result.code === 0) {
                                                                window.location.reload();
                                                            }
                                                            else{
                                                                alert(result);
                                                            }
                                                        });
                                            }
                                      
                                        });

</script>